<include file="Layout/header" />
<body>
<div class="breadcrumbs" id="breadcrumbs"> 
  <script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>
  <ul class="breadcrumb">
    <li> <i class="icon-home home-icon"></i> <a href="{:U('Admin/Index/welcome')}">首页</a> </li>
    <li class="active">会员管理</li>
  </ul>
</div>
<div class="page-content">
  <div class="page-header">
    <h1> 会员管理 <small> <i class="icon-double-angle-right"></i> 充值提现列表 </small> </h1>
  </div>
  <div class="row">
    <form method="get" action="{:U('Admin/Member/withdrawals')}">
      <table class="table table-striped table-bordered table-hover table-condensed">
        <tr>
           <td width="15%"><input class="col-xs-12 col-sm-8" type="text" name="member_name" placeholder="会员名称/手机号码"></td>
          
          <th width="10%"> <select class="input-medium"  name="status">
             
                <option value="0" <?php if($_GET['status']=='0'){?>  selected = "selected"  <?php } ?>>未处理</option>
                <option value="1" <?php if($_GET['status']=='1'){?>  selected = "selected"  <?php } ?>>已处理</option>
                
            </select>
          </th>
      <!--     <th width="10%"> <select class="input-medium"  name="type">
               <option value="2" <?php if($_GET['type']=='2'){?>  selected = "selected"  <?php } ?>>提现</option>
                <option value="1" <?php if($_GET['type']=='1'){?>  selected = "selected"  <?php } ?>>充值</option>
              
                
            </select>
          </th>-->
          
          <th width="30%"> 
            <div class="col-xs-3">
              <div class="input-group input-group-sm">
                <input id="datepicker" class="form-control hasDatepicker" name="strtime" type="text" value="<?php echo $_GET['strtime'];?>">
                <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div>
             </div>
             <div class="col-xs-1" style="padding: 5px 18px;">至</div>
             <div class="col-xs-3">
              <div class="input-group input-group-sm">
                <input id="datepicker1" class="form-control hasDatepicker" name="endtime" type="text" value="<?php echo $_GET['endtime'];?>">
                <span class="input-group-addon"> <i class="icon-calendar"></i> </span> </div>
             </div> 
           
          </th>
          <td width="20%"><input class="btn btn-success" type="submit" value="搜索"></td>
        </tr>
      </table>
    </form>
    <div class="col-xs-12">
   <div class="table-responsive">
        <table id="sample-table-1" class="table table-striped table-bordered table-hover">
          <thead>
            <tr>
             
              <th>编号</th>
              <th>会员名称/真实姓名</th>
             
              <th>金额</th>
              <th>申请时间</th>
            
              <th>分类</th>
              <th>状态</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
        
            <foreach name="list" item="val">
              <tr class="selected">
             
                <td>{$val.id}</td>
                <td>{$val.member_name}<if condition="$val.true_name neq ''">/{$val.true_name}</if></td>
                <td>{$val.money}</td>
             
                <td><?php echo date('Y-m-d H:i:s',$val['add_time']);?></td>
             <td class="td-status">
			 <if condition="$val.type eq 1"> 
			 <span class="label label-sm label-success">充值</span>
				   <else/>
                  
					<span class="label label-sm label-success">提现</span>
					</if>
                    </td>
                <td class="td-status"><if condition="$val.status eq '1'"> 
				<span class="label label-sm label-success">处理完成</span>
				   <else/>
                    <span class="label label-sm label-inverse arrowed-in">未处理</span>
					</if>
                    </td>
                <td><div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                    <if condition="$val.type eq '2'"> 
					<a class="btn btn-xs <if condition="$val.status eq '1'"> btn-success <else/> btn-inverse  </if>" onClick="cash_save(this,{$val.id},2)" href="javascript:;">
					
					<if condition="$val.status eq '1'">
					<i class=" icon-ok bigger-120"></i> 
					<else/>
					<i class=" icon-ban-circle bigger-120"></i> 
					</if>
					</a>
                     

					 <else/>
					 <!-- 充值 -->
					 <a class="btn btn-xs <if condition="$val.status eq '1'"> btn-success <else/> btn-inverse  </if>" onClick="cash_save(this,{$val.id},1)" href="javascript:;">
					 
					 <if condition="$val.status eq '1'">
					<i class=" icon-ok bigger-120"></i> 
					<else/>
					<i class=" icon-ban-circle bigger-120"></i> 
					</if>
					 </a>
                     

					
					 </if>
                  
 </div></td>
              </tr>
            </foreach>
      
            </tbody>
          
        </table>
       
      </div>
     
      <input type="hidden" value="{:U('Admin/Member/examine_del')}" id="member_del">
      <!-- /.table-responsive --> 
    </div>
    <div >{$page}</div>
  </div>
</div>

<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
        <h4 class="modal-title" id="myModalLabel"> 处理提现</h4>
      </div>
      <div class="modal-body">
        <form id="bjy-form" class="form-inline" action="{:U('Admin/Member/cash_save')}" method="post">
          <input type="hidden" name="id" value="">
		  <input type="hidden" name="type" value="2">
          <table class="table table-striped table-bordered table-hover table-condensed">
		    <tr>
              <th>用户：</th>
              <td id="username"></td>
            </tr>
			<tr>
              <th>账户名：</th>
              <td id="truename"></td>
            </tr>
			 <tr>
              <th>开户行/卡号：</th>
              <td id="bank"></td>
            </tr>
			 <tr>
              <th>提现金额：</th>
              <td id="money"></td>
            </tr>
          <tr>
              <th>用户备注：</th>
              <td id="remark"></td>
            </tr>
            <tr>
              <th>管理员备注：</th>
              <td id="mark"><input class="form-control" type="text" name="a_remark" placeholder="请填写备注">
                </td>
            </tr>
			 <tr>
              <th>处理结果：</th>
              <td id="status">
			  <select class="input-medium" name="status">
              
                <option value="0">未处理</option>
                <option value="1">处理</option>
              
          	  </select>
                </td>
            </tr>
            <tr>
              <th></th>
              <td id="button"><input class="btn btn-success" type="submit" value="确认"></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<!-- 充值哦 -->
<div class="modal fade" id="chonzhi-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
        <h4 class="modal-title" id="myModalLabel"> 处理充值</h4>
      </div>
      <div class="modal-body">
        <form id="bjy-form" class="form-inline" action="{:U('Admin/Member/cash_save')}" method="post">
          <input type="hidden" name="type" value="1">
          <input type="hidden" name="id" value="" >
          <table class="table table-striped table-bordered table-hover table-condensed">
		    <tr>
              <th>用户：</th>
              <td id="username_c"></td>
            </tr>
			
			 <tr>
              <th>充值金额：</th>
              <td id="money_c"></td>
            </tr>
          <tr>
              <th>用户备注：</th>
              <td id="remark_c"></td>
            </tr>
            <tr>
              <th>管理员备注：</th>
              <td id="mark_c"><input class="form-control" type="text" name="a_remark"  placeholder="请填写备注">
                </td>
            </tr>
			 <tr>
              <th>处理结果：</th>
              <td id="status_c">
			  <select class="input-medium" name="status">
              
                <option value="0">未处理</option>
                <option value="1">处理</option>
              
            </select>
                </td>
            </tr>
			 <!-- <tr>
              <th >转账凭证：</th>
              <td id="img" >
			  
                </td>
            </tr> -->
            <tr>
              <th></th>
              <td id="button_c"><input class="btn btn-success" type="submit" value="确认"></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<include file="Layout/js"/> 
<link href="__ADMIN_CSS__/datepicker.css" rel="stylesheet" />
<script src="__ADMIN_JS__/date-time/bootstrap-datepicker.min.js"></script>
<script src="__ADMIN_JS__/jquery.ui.touch-punch.min.js"></script>
<script src="__ADMIN_JS__/jquery.dataTables.min.js"></script> 
<script src="__ADMIN_JS__/jquery.dataTables.bootstrap.js"></script> 
<script src="__ADMIN_JS__/bootbox.js"></script> 
<script type="text/javascript">
			jQuery(function($) {
				$("#datepicker").datepicker({
					showOtherMonths: true,
					selectOtherMonths: false,
					 
				});
				 
				$("#datepicker1").datepicker({
					showOtherMonths: true,
					selectOtherMonths: false,
					 
				}); 
				
				var oTable1 = $('#sample-table-2').dataTable( {
				"aoColumns": [
			      { "bSortable": false },
			      null, null,null, null, null,
				  { "bSortable": false }
				] } );
				
				
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			
  				
			})
 		</script> 
<script type="text/javascript">   


// 审核
function cash_save(obj,id,type){
	
	
	$("input[name='id']").val(id);
	if(type==1){
	$('#chonzhi-edit').modal('show');
	  $.ajax({
			url:"{:U('Admin/Member/withdrawals')}",
			type:"POST",
			dataType:"json",
			data:{id:id},
			success: function(s){
 				
 				$("#username_c").html(s.member_name);
 				$("#money_c").html(s.money);
 				
 				$("#remark_c").html(s.remark);
 				
 				$("#img").html('<a href="'+s.filename+'"><img src="'+s.filename+'" style="max-height:200px;"></a>');
				if(s.status==1){
					$("#mark_c").html(s.a_remark);
					$("#status_c").html(s.type);	
					$("#button_c").hide();
					$("#button_c").parent().hide();
				}else{
					var type ="	<select class="+"input-medium"+" name="+"status"+"> <option value="+"0"+">未处理</option> <option value="+"1"+">处理</option> </select>";
					var mark="<input class="+"form-control"+" type="+"text"+" name="+"a_remark"+"  placeholder="+"请填写备注"+">";
					
					$("#mark_c").html(mark);
					$("#status_c").html(type);
					$("#button_c").show();
					$("#button_c").parent().show();
				}
			}
			})
	}else{
	$('#bjy-edit').modal('show');
	  $.ajax({
			url:"{:U('Admin/Member/withdrawals')}",
			type:"POST",
			dataType:"json",
			data:{id:id},
			success: function(s){
 				$("#bank").html(s.bank_name+'/'+s.bank_num);
 				$("#username").html(s.member_name);
 				$("#truename").html(s.true_name);
 				$("#money").html(s.money);
 				
 				$("#remark").html(s.remark);
 				
				if(s.status==1){
					$("#status").html(s.type);
					$("#mark").html(s.a_remark);
					$("#button").hide();
					$("#button").parent().hide();
				}else{
					var type ="	<select class="+"input-medium"+" name="+"status"+"> <option value="+"0"+">未处理</option> <option value="+"1"+">处理</option> </select>";
					var mark="<input class="+"form-control"+" type="+"text"+" name="+"a_remark"+"  placeholder="+"请填写备注"+">";
					$("#status").html(type);
					$("#mark").html(mark);
					$("#button").show();
					$("#button").parent().show();
				}
			}
			})
	}
	
	

}    
 </script>
</body>
</html>